let widgetTemplates = [
    {
        widgetType: "text",
        title: "文本",
        placeholder: "请输入",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    {
        widgetType: "number",
        title: "数值",
        placeholder: "请输入数值",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    {
        widgetType: "select",
        title: "单选",
        placeholder: "",
        options: {
            dataSource: "手动添加",
            fixedValues: [

            ],
            dataSourceApi: {
                url: null,
                token: null,
                key: null
            }
        },
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    {
        widgetType: "textarea",
        title: "长文本",
        placeholder: "请输入",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    {
        widgetType: "attachment",
        title: "附件",
        placeholder: "",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    {
        widgetType: "user",
        title: "联系人",
        placeholder: "",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    {
        widgetType: "date",
        title: "日期",
        placeholder: "请选择",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    }
]

let widgetTemplateMap = {
    text:
    {
        widgetType: "text",
        title: "文本",
        placeholder: "请输入",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    number: {
        widgetType: "number",
        title: "数值",
        placeholder: "请输入数值",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    select: {
        widgetType: "select",
        title: "单选",
        placeholder: "",
        options: {
            dataSource: "手动添加",
            fixedValues: [

            ],
            dataSourceApi: {
                url: null,
                token: null,
                key: null
            }
        },
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    textarea: {
        widgetType: "textarea",
        title: "长文本",
        placeholder: "请输入",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    attachment: {
        widgetType: "attachment",
        title: "附件",
        placeholder: "",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    user: {
        widgetType: "user",
        title: "联系人",
        placeholder: "",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    },
    date: {
        widgetType: "date",
        title: "日期",
        placeholder: "请选择",
        print: true,
        required: false,
        defaultValue: {
            enable: false,
            value: null
        },
        id: null
    }
}

export function buildFormItem(widgetType) {
    return widgetTemplateMap[widgetType];
}